<template>
  <div class="template-container">
    <div class="template-content">
      <TemplateName @use="use" :template="template" v-for="template in templates" :key="template.id"></TemplateName>
    </div>

    <div class="template-btn">
      <span @click="$emit('close')">取消</span>
    </div>
  </div>
</template>
<script>
import TemplateName from './Template'

export default {
  props: {
    templates: Array
  },
  methods: {
    use (id) {
      this.$emit('use', id)
    }
  },
  components: {
    TemplateName
  }
}
</script>
<style lang="less" scoped rel="stylesheet/less">
  .template-container {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    background-color: #F6F9FE;
    overflow-y: scroll;
  }

  .template-content {
    padding-bottom: 60px;
  }

  .template-btn {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    display: flex;
    z-index: 100;

    > span {
      flex: 1;
      padding: 15px;
      text-align: center;
      color: #fff;
      background: linear-gradient(to bottom, #8ba3fa, #7ec0f7)
    }
  }
</style>
